FastAPI by AUTHOR NAMES HERE

FastAPI by AUTHOR NAMES HERE

Author:AUTHOR NAMES HERE
Language: eng
Format: epub, mobi
Publisher: O'Reilly Media, Inc.


Type Hints

All of this background has a point.

Python 3.6 added type hints to declare the type of object to which a variable refers. These are not enforced by the Python interpreter as it’s running! Instead, they can be used by various tools to ensure that your use of a variable is consistent. The standard type checker is called mypy, and I’ll show you how it’s used later.

A type hint may just seem like a nice thing, like many “lint” tools used by programmers to avoid some mistakes. For instance, it may remind you that your variable count refers to a Python object of type int. But hints, although they’re optional and unenforced notes (literally, “hints”), turn out to have unexpected uses. Later in this book, you’ll see how FastAPI adapted the Pydantic package to make very clever use of type hinting.

The addition of type declarations may be a trend in other, formerly typeless, languages. For example, many JavaScript developers have moved to TypeScript.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.